package com.olap.starter.common.util;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class ExceptionParse {
    public static String getExceptionAllInfo(Throwable ex) {
        ByteArrayOutputStream out = null;
        PrintStream pout = null;
        String ret = "";
        try {
            out = new ByteArrayOutputStream();
            pout = new PrintStream(out);
            ex.printStackTrace(pout);
            ret = new String(out.toByteArray());
            out.close();
        }catch(Exception e){
            return ex.getMessage();
        }finally{
            if(pout!=null){
                pout.close();
            }
        }
        return ret;
    }
}
